﻿@model RoadFlow.Model.FlowButton
<form method="post">
    @Html.AntiForgeryToken()
    <br />
    <input type="hidden" name="id" value="@Model.Id" />
    <table cellpadding="0" cellspacing="1" border="0" width="99%" class="formtable">
        <tr>
            <th style="width: 80px;">按钮名称：</th>
            <td>
                <input type="text" name="title" id="title" class="mytext" value="@Model.Title" validate="empty" style="width: 75%" />
            </td>
        </tr>
        <tr>
            <th>按钮图标：</th>
            <td>
                <input type="text" name="ico" id="ico" class="myico" source="" value="@Model.Ico" style="width: 75%" />
            </td>
        </tr>
        <tr>
            <th>
                执行脚本：
            </th>
            <td>
                <textarea class="mytext" name="script" rows="1" cols="1" style="width:90%; height:180px; line-height:16px; color:Blue; font-family:Courier New; padding:5px;">@Model.Script</textarea>
            </td>
        </tr>
        <tr>
            <th>按钮说明：</th>
            <td>
                <textarea class="mytext" name="note" rows="1" cols="1" style="width:90%; height:50px;">@Model.Note</textarea>
            </td>
        </tr>
        <tr>
            <th>排序：</th>
            <td>
                <input type="text" name="sort" id="sort" class="mytext" value="@Model.Sort" />
            </td>
        </tr>
    </table>
    <div class="buttondiv">
        <input type="button" value="确定保存" class="mybutton" onclick="checkform(this);" />
        <input type="button" class="mybutton" value="取消关闭" style="margin-left: 5px;" onclick="new RoadUI.Window().close();" />
    </div>
</form>
<script type="text/javascript">
    $(window).load(function () {

    });
    function checkform(but) {
        var f=document.forms[0];
        if (new RoadUI.Validate().validateForm(f))
        {
            var o = RoadUI.Core.serializeForm($(f));
            $(but).prop("disabled", true);
            $.ajax({
                url: "Save@(Html.Raw(ViewData["queryString"]))", data: o, type: "post", success: function (text)
                {
                    if (RoadUI.Core.checkLogin(text))
                    {
                        alert(text);
                    }
                    $(but).prop("disabled", false);
                    new RoadUI.Window().reloadOpener();
                    new RoadUI.Window().close();
                }
            });
        }
    }
</script>